<template>
  <h1>编辑公告</h1>
  <el-input
    v-model="notice"
    type="textarea"
    :rows="30"
    placeholder="请输入公告"
  />
  <div style="display: flex; justify-content: flex-end">
    <el-button
      @click="submit"
      style="margin-top: 10px"
      type="primary"
      size="large"
      >保存</el-button
    >
  </div>
</template>
<script setup>
import { getNotice, save } from "@/api/notice";
import { ElMessage, ElMessageBox } from "element-plus";
import { ref } from "vue";

const notice = ref("");
const getData = async () => {
  let data = await getNotice();
  notice.value = data.data.data.content;
};
getData();
const submit = async () => {
  await save({
    content: notice.value,
  });
  ElMessage.success("保存成功");
};
</script>
